﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AassignMenu.aspx.cs" Inherits="XYTXL.View.AassignMenu" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title> 
    <link href="/View/CSS/bootstrap3.3.5/css/bootstrap.css" rel="stylesheet" />
    
    <link rel="stylesheet" type="text/css" href="/View/JS/zTree_v3/css/zTreeStyle/zTreeStyle.css" /> 
    <script src="/View/JS/jquery-1.11.2.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="/View/JS/zTree_v3/js/jquery.ztree.core-3.5.min.js"></script>
    <script type="text/javascript" src="/View/JS/zTree_v3/js/jquery.ztree.excheck-3.5.min.js"></script>
    <script type="text/javascript">
        var zNodes = null;
        var zTreeObj = null;
        var setting = {
            data: {
                simpleData: {
                    enable: true,
                    idKey: "id",
                    pIdKey: "pId",
                    rootPId: 0
                }
            },
            check: {
                enable: true,
                chkStyle: "checkbox",
                chkboxType: { "Y": "ps", "N": "s" }
            },
            view: {
                showLine: false
            },
            callback: {
                onCheck: zTreeOnCheck
            }
        };

        $(document).ready(function () {

            $.ajax({
                type: "GET",
                url: "AdminHandle.ashx",
                dataType: "html",
                data: { "RoleCode": $("#hidRoleCode").val(), "Action": "GetRoleMenu" },
                success: function (msg) {
                    zNodes = eval(msg);
                    zTreeObj = $.fn.zTree.init($("#tree"), setting, zNodes);
                }
            });
        })


        //checkbox选中事件

        function zTreeOnCheck(event, treeId, treeNode) {
            var checknodes = zTreeObj.getCheckedNodes(true);
            var s = "";
            if (checknodes.length != 0) {
                $.each(checknodes, function (i, n) {
                    s = s + n.id + ',';
                });
                $("#hidCheckNodes").val(s);
            }
        };
    </script>
</head>
<body>
    <form id="form" runat="server">

        <div class="container-fluid">
            <div class="row">
                <div class="col-xs-6" style="padding: 0">
                    <div class="panel panel-default">
                        <div class="panel-heading">菜单及按钮权限 </div>
                        <div class="panel-body" style="min-height: 250px">
                            <ul id="tree" class="ztree">
                            </ul>
                        </div>
                        <div class="panel-footer">
                            <asp:Button ID="btAssignMenu" CssClass="btn btn-success btn-sm" runat="server" Text="确认"
                                OnClick="btAssignMenu_Click" />
                        </div>

                    </div>

                </div>
                <div class="col-xs-6" style="padding: 0; display: none">
                    <div class="panel panel-default">
                        <div class="panel-heading">数据权限 </div>
                        <div class="panel-body" style="min-height: 250px">
                            <div class="checkbox">
                                <label>
                                    <input type="radio" id="conMyData" runat="server" checked="true" name="datara">
                                    只能查看本人数据
                                </label>
                            </div>
                            <div class="checkbox">
                                <label>
                                    <input type="radio" id="conBMData" runat="server" name="datara">
                                    查看本部门数据
                                </label>
                            </div>
                            <div class="checkbox">
                                <label>
                                    <input type="radio" id="conAllData" runat="server" name="datara">
                                    查看全部数据
                                </label>
                            </div>
                        </div>
                        <div class="panel-footer">
                            <asp:Button ID="Button1" CssClass="btn btn-success btn-sm" runat="server" Text="确认"
                                OnClick="btAssignMenu_Click" />
                        </div>
                    </div>
                </div>

            </div>
        </div>

        <input id="hidCheckNodes" type="hidden" value="" runat="server" />
        <input id="hidRoleCode" type="hidden" value="" runat="server" />


    </form>
</body>
</html>
